<? 
include_once("codelibrary/inc/variables.php");
include_once("session.php");
include_once("codelibrary/inc/functions.php");

$business_id = $_SESSION['business_id'];

$query = mysql_query("select * from staff where business_id = '".$business_id."'");
$rows = mysql_num_rows($query);

// --------------------  Code to insert into staff table --------------------------
if(isset($_REQUEST['ab']))
{
	$del = $_REQUEST['ab'];
	foreach($del as $q)
	{
		mysql_query("delete from staff where staff_id = '".$q."'");
		echo "<script>window.location.href='staff_members.php';</script>";
	}
}

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Online Appointment</title>
<script>
function pass()
{
	var agree = confirm("Are you sure you want to delete the selected Staff Members");
	if(agree)
		window.location.href="staff_members.php";
	else
		return false;
}
</script>

<base >
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Staff Management</title>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">


<table cellpadding="0" cellspacing="0" border="0"><tr>
  <td style="background:url(images/top.gif) repeat-x top; ">
<table cellpadding="0" cellspacing="0" border="0" style="width:764px" align="center"> 
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" style="height:57">
				<tr>
					<td height="57">
<? html_header(); ?>					</td>
				</tr>
			</table>


		</td>
	</tr>
	<tr>
		<td>





<table border="0" width="105%" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" class="col_left">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_left">
	<tr><td width="100%">
		<table border="0" cellspacing="0" cellpadding="0">
<tr><td>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  class="" height="91">
  <tr>
    <td align="center" height="91">
    <img border="0" src="images/logo.jpg" width="208" height="86"></td>
  </tr>
</table>
</td>
  </tr>
</table>
</td></tr>


          <tr>
            <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_header_txt" height="48">
  <tr>
    <td style="background-image: url(images/1_bg2-2.gif)" height="1">
      <p style="margin-top: 16"> </td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0"   style="border-bottom:12px solid #ffffff;">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:0px;background:#7C7C7C url(images/1_line.gif) no-repeat left bottom;" >
  <tr>
    <td  style="padding:3px 16px 8px 25px;">
      <table width="100%" border="0">
        <tr>
          <td colspan="2" align="left"><a href="add_newstaff.php" class="topmenulink">Add New Staff Member</a> </td>
          </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</td>
  </tr>
</table>
            </td>
          </tr>


          <tr>
            <td class="">&nbsp;
</td>
          </tr>

		</table>
	</td>
	<td><img src="images/spacer.gif" border="0" alt="" width="15" height="1"></td></tr>
</table>

    </td>

    <td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="cont_header_txt">
  <tr>
    <td>
			<table border="0" cellpadding="0" cellspacing="0" bgcolor="#EAEAEA" class="cont_header_txt">
				<tr>
					<td><img src="images/1_q1.gif" border="0" alt="" width="45" height="39"></td>
					<td style="width:100%">Staff Members </td>
					<td><img src="images/1_q2.gif" border="0" alt="" width="10" height="39"></td>
				</tr>
			</table>										 
			</td>
  </tr>
</table>


						
						<form name="form1" method="post" action="">
						<table width="107%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFDBCA" class="table" >
						<? if($rows != 0) {?>
                          <tr>
                            <td height="25" colspan="5" align="center" bgcolor="#FFFFFF" class="H1">&nbsp;</td>
                          </tr>
                          <tr>
                            <td width="23%" height="25" align="center" bgcolor="#FFFFFF" class="H1"><!-- new_products //-->Name</td>
                            <td width="24%" height="25" align="center" bgcolor="#FFFFFF" class="H1" >Email</td>
                            <td width="23%" height="25" align="center" bgcolor="#FFFFFF" class="H1" >Access Type </td>
                            <td width="19%" height="25" align="center" bgcolor="#FFFFFF" class="H1" >Display </td>
                            <td width="11%" height="25" align="center" bgcolor="#FFFFFF" class="H1">
                            <input name="Submit" type="submit" class="button" value="Delete" onClick="pass()"> </td>
                          </tr>
						  <? while($data = mysql_fetch_array($query)) {?>
                          <tr>
                            <td height="25" nowrap bgcolor="#FFFFFF" class="simpletxt">&nbsp;<a href="profile.php?business_id=<? echo $business_id?>&staff_id=<? echo $data['staff_id'];?>" class="midlink"><? echo $data['first_name']." , ".$data['last_name'];?></a>&nbsp;</td>
                            <td height="25" nowrap bgcolor="#FFFFFF" class="simpletxt" >&nbsp;<? echo $data['email'];?></td>
                            <td height="25" bgcolor="#FFFFFF" class="simpletxt" >&nbsp;<? echo $data['access_type'];?></td>
                            <td height="25" align="center" bgcolor="#FFFFFF" class="simpletxt" ><? echo $data['customer_see'];?></td>
                            <td height="25" align="center" bgcolor="#FFFFFF"><label>
                              <input name="ab[]" type="checkbox" id="ab[]" value="<? echo $data['staff_id'];?>">
                            </label></td>
                          </tr>
						  <? }}else {?>
	                      <tr>
                            <td height="25" colspan="5" align="center" bgcolor="#FFFFFF" class="errTxt"><p><br>
                                <br>
                              No Staff Members Found..<br>
                            </p>
                            <p>&nbsp;</p></td>
                          </tr>
						  <? }?>
                        </table>
						</form>
						
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td><img src="images/1_q4.gif" border="0" alt="" width="10" height="10"></td>
								<td style="width:100%; background-image:url(images/1_li1.gif)"></td>
								<td><img src="images/1_q3.gif" border="0" alt="" width="10" height="10"></td>
							</tr>
						</table>
						


		
		
		</td>

    <td class="col_right">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_right">
	<tr><td></td>
		<td width="100%">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr><td></td></tr>
			</table>
		</td>
	</tr>
</table>


    </td>
  </tr>
</table>



		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" style="height:98px; background-image:url(images/bot.gif)">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" border="0" class="footer">
							<tr>									
								<td height="77"><img src="images/spacer.gif" border="0" alt="" width="25" height="1"></td>				
								<td style="width:207px"><br style="line-height:49px"><img src="images/p1.gif" border="0" alt="" width="145" height="24"><br></td>
							  <td style="width:532px">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table></td></tr></table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"></td>
  </tr>
</table>
</body>

</html>